<template>
	<view>
		<view v-for="item in list" class="list" :data-data="item" @click="targetDepartmentIntr">
			<view>{{item.title}}</view>
			<view>
				<image :src="item.thumb" />
				<view v-html="item.content"></view>
			</view>
		</view>
	</view>
</template>

<script>
	import {
		section
	} from '../../request/index.js'
	import baseUrl from '../../request/baseUrl.js'
	export default {
		data() {
			return {
				list: [],
			}
		},
		onLoad() {
			this.request();
		},
		methods: {
			request() {
				section().then(res => {
					this.list = res.data.list.map(item => {
						item.thumb = baseUrl + item.thumb;
						return item
					});
					console.log(this.list[0]);
				})
			},
			targetDepartmentIntr(event) {
				// console.log(event.currentTarget.dataset.data);
				uni.setStorageSync('departmentIntr', event.currentTarget.dataset.data)
				uni.navigateTo({
					url: '/pages/departmentIntr/index'
				})
			}
		},
	}
</script>

<style lang="scss">
	page {
		background: #efefef;
		padding-bottom: 2vh;
	}

	.list {
		width: 95%;
		background: white;
		margin: 2vh auto;
		padding: 2vh 0;
		border-radius: 10px;

		>view {
			&:first-child {
				display: grid;
				place-content: center;
				font-size: 21px;
				margin-bottom: 2vh;
			}

			&:nth-child(2) {
				display: flex;
				justify-content: space-around;

				>image {
					width: 22vw;
					height: 22vw;
				}

				>view {
					width: 57.5%;
				}
			}
		}
	}
</style>
